<?php
/**
 * Yotaku shop - yshop
 * Copyright (c) 2016 http://www.yotaku.cn All rights reserved.
 * Author: Creatint <creatint@163.com> <http://creatint.yotaku.cn>
 */
namespace Home\Controller;
class CateController extends HomeController{
    public function __construct()
    {
        parent::__construct();

        //底部菜单设置
        $menus = C("MENUS");
        $menus[1] = array(
            'href'      =>  U('/Cate/index'),
            'li_class'  =>  'margin-r',
            'src'       =>  C('TMPL_PARSE_STRING')['__IMG__'].'/menu-22.png',
            'p_class'   =>  'color-menu',
            'text'      =>  '分类'
        );
        C("MENUS",$menus);
    }

    public function index(){
        //获取分类数据
        $Category   =   D("Category");
        $categorys   =   $Category->getCategory();//扁平数据
//        getDepth($categorys,0,'child','depth');
//        $categorys = tree_to_list($categorys,'child');
        $this->assign('categorys',$categorys);
        trace($categorys);

        $this->display();
    }
}